import http from "@/axios";
// import { pa } from "element-plus/lib/locale";

/**
 * 查询商品（分页）
 *
 * 可以传入name(模糊匹配)，categoryId（叶子分类id精确匹配）
 */
export function queryGoodsList(params) {
  return http({
    url: "/goods/list",
    method: "get",
    params,
  });
}

/**
 * 查询商品详情(spu详情，包含其下sku列表)
 */
export function queryGoodsInfo(spuNo) {
  return http({
    url: `/goods/info/${spuNo}`,
    method: "get",
  });
}

/**
 * 热点分类，limit为查询多少个，排序规则按照sort_no越大越靠前
 */
export function queryHotCategoryList(limit) {
  return http({
    url: `/goods/category/hot/${limit}`,
    method: "get",
  });
}

/**
 * 查询分类树
 *
 * page：当前页
 * limit： 一页多少个
 */
export function queryCategoryTree(params) {
  return http({
    url: "/goods/category/tree",
    method: "get",
    params: params,
  });
}

/**
 * 获取评价信息指定商品
 */
export function evaluateInfo(params) {
  return http({
    url: `/goods/evaluation/list/`,
    method: "get",
    params: params,
  });
}

/**
 * 查询首页商品推荐
 */
export function queryHomeGoods() {
  return http({
    url: "/goods/home/list",
    method: "get",
  });
}
/**
 * 查询某个评价信息的评论信息
 */
export function queryCommentReplay(params) {
  return http({
    url: "/commentreply/list",
    method: "get",
    params: params,
  });
}
/**
 * 添加评价
 */
export function saveCommentInfo(commentReplyInfo) {
  return http({
    url: "/commentreply/save",
    method: "post",
    data: commentReplyInfo,
  });
}
/**
 * 添加回复
 */
export function saveCommentReplay(commentReplyInfo) {
  return http({
    url: "/commentreply/save",
    method: "post",
    data: commentReplyInfo,
  });
}
